#include <iostream>
#include <vector>

template <typename T> void move(std::vector<T> &A, std::vector<T> &C) {
  // 只有一个元素 将元素直接从A柱移动至C柱
  T t = A.back();
  A.pop_back();
  C.push_back(t);
}

template <typename T>
void dfs(int i, std::vector<T> &A, std::vector<T> &B, std::vector<T> &C) {
  if (i == 1) {
    move<int>(A, C);
    return;
  }
  // 1.将n-1个元素从A借助C移动到B
  dfs(i - 1, A, C, B);
  // 2.将1个元素先从A移动到C
  move(A, C);
  // 3.将n-1个元素从B借助A移动至C
  dfs(i - 1, B, A, C);
}

template <typename T>
void solveHanota(std::vector<T> &A, std::vector<T> &B, std::vector<T> &C) {
  dfs(A.size(), A, B, C);
}

int main() {
  std::vector<int> A{1, 2, 3, 4, 5, 6};
  std::vector<int> B;
  std::vector<int> C;
  solveHanota(A, B, C);
  std::cout << A.size() << std::endl;
  std::cout << B.size() << std::endl;
  std::cout << C.size() << std::endl;
  for (int i = 0; i < C.size(); i++) {
    std::cout << C[i] << " ";
  }
  std::cout << std::endl;
}